LotusScript Doc

Class: LSAOrgaManager

The LSAOrgaManager is the top class of the LSA Orga interface. It manages access to the LSAOrga and LSAOrgaLog database and handles the units and types, hereby giving access to all the objects of the LSAOrga. It holds methods to create and get units and type definitions from the LSAOrga. If you want to work with these objects you always need to get them with the LSAOrgaManager.

Author:
LPS EMEA
Version:
2.0, 01.OCT.2000
History:
09.May.2000RPrchanged errorhandlers with Errormessages 16.NOV.2000 RPr new documentation



Property Summary
Public Property Get AddressDB As NotesDatabase
Public Property Get AddressLUView As NotesView
Public Property Get AttributeArray As Variant
Public Property Get ClosingFormats As Variant
Public Property Get ClosingTypes As Variant
Public Property Get ContactDisplayRule As String
Public Property Get ContactLUView As NotesView
Public Property Get CountriesWithoutAreaCode As Variant
Public Property Get CurrentLog As LSAOrgaLog
Public Property Get CurrentOrgaDatabase As NotesDatabase
Public Property Get CustomerLUView As NotesView
Public Property Get GroupTypeS As Variant
Public Property Get IdLUView As NotesView
Public Property Get InstanceID As String
Public Property Get LabelFormats As Variant
Public Property Get LabelTypes As Variant
Public Property Get OpeningFormats As Variant
Public Property Get OpeningTypes As Variant
Public Property Get OrganizationDisplayRule As String
Public Property Get OrganizationLUView As NotesView
Public Property Get PersonTypeS As Variant
Public Property Get PhoneFormat As String
Public Property Set PhoneFormat As String
Public Property Set SurrogationDate As NotesDateTime
Public Property Get SurrogationDate As NotesDateTime
Public Property Get TraitTypeS As Variant
Public Property Get ViewAddresses As NotesView
Public Property Get ViewAllOrgaDocs As NotesView

Method Summary
Sub Delete ()
Function getAddressDocsByKey (key As String) As NotesDocumentCollection
Function GetNotesDatabaseByAliasParameter (AliasName As String, DefaultAliasName As String) As NotesDatabase
Function GetNotesDatabaseByDBParameter (DBase As Variant) As NotesDatabase
Function GetOrgaDocByKey (OrgaView As String, Key As String) As NotesDocument
Function GetOrgaTypeS (OrgaView As String) As Variant
Function GetTypeByExtSyncKey (ExtSystem As String, ExtSyncKey As String) As LSAOrgaType
Function GetTypeByName (OrgaName As String) As LSAOrgaType
Function GetUnitByExtSyncKey (ExtSystem As String, ExtSyncKey As String) As LSAOrgaUnit
Function GetUnitByName (OrgaInternalName As String) As LSAOrgaUnit
Function GetUnitByNotesName (OrgaNotesName As NotesName) As LSAOrgaUnit
Sub IsOrgaDB (DBase As NotesDatabase)
Sub New (Database As Variant, OrgaDBAlias As String, LogDatabase As Variant, LogDBAlias As String)
Function NewOrgaCollection (ExtSystem As String, OrgaClassName As Variant, NotesName As Variant, OrgaTypeName As Variant) As LSAOrgaCollection
Function NewType (OrgaName As String, OrgaSubtype As String) As LSAOrgaType
Function NewUnit (OrgaName As String, OrgaType As LSAOrgaType, OrgaNotesName As String, OrgaNotesType As String) As LSAOrgaUnit
Sub null ()
Function PopulateAllChanges () As Integer

Property Detail

Public Property Get GroupTypeS AsVariant

This property returns an array of strings with the names of all group types from the LSA Orga metamodel.

Use Case:
You want to get all group type objects of the LSAOrga
	Dim OrgaManager As LSAOrgaManager
	Dim allGroupTypeNames As Variant
	Dim allGroupTypes As LSAOrgaCollection
	Dim aOrgaType As LSAOrgaType
	Dim aTypeName As String
	
	Set OrgaManager = New LSAOrgaManager("", "LSAORGA", "", "LSAORGALOG")
	allGroupTypeNames = OrgaManager.GroupTypeS
	Set allGroupTypes = New LSAOrgaCollection
	Forall aGroupTypeName In allGroupTypeNames
		aTypeName = aGroupTypeName
		Set aOrgaType = OrgaManager.GetTypeByName(aTypeName)
		Call allGroupTypes.AddEntry(aOrgaType)
	End Forall

Returns:
GroupTypesVariant array of strings
History:
04.APR.2000ggredesign
Summmary Top

Public Property Get TraitTypeS AsVariant

This property returns an array of strings with the names of all trait types from the LSA Orga metamodel.

Use Case:
You want to get all trait type objects of the LSAOrga
	Dim OrgaManager As LSAOrgaManager
	Dim allTraitTypeNames As Variant
	Dim allTraitTypes As LSAOrgaCollection
	Dim aOrgaType As LSAOrgaType
	Dim aTypeName As String
	
	Set OrgaManager = New LSAOrgaManager("", "LSAORGA", "", "LSAORGALOG")
	allTraitTypeNames = OrgaManager.TraitTypeS
	Set allTraitTypes = New LSAOrgaCollection
	Forall aTraitTypeName In allTraitTypeNames
		aTypeName = aTraitTypeName
		Set aOrgaType = OrgaManager.GetTypeByName(aTypeName)
		Call allTraitTypes.AddEntry(aOrgaType)
	End Forall

Returns:
TraitTypesVariant array of strings
History:
04.APR.2000ggredesign
Summmary Top

Public Property Get PersonTypeS AsVariant

This property returns an array of strings with the names of all person types from the LSA Orga metamodel.

Use Case:
You want to get all person type objects of the LSAOrga
	Dim OrgaManager As LSAOrgaManager
	Dim allPersonTypeNames As Variant
	Dim allPersonTypes As LSAOrgaCollection
	Dim aOrgaType As LSAOrgaType
	Dim aTypeName As String
	
	Set OrgaManager = New LSAOrgaManager("", "LSAORGA", "", "LSAORGALOG")
	allPersonTypeNames = OrgaManager.PersonTypeS
	Set allPersonTypes = New LSAOrgaCollection
	Forall aPersonTypeName In allPersonTypeNames
		aTypeName = aPersonTypeName
		Set aOrgaType = OrgaManager.GetTypeByName(aTypeName)
		Call allPersonTypes.AddEntry(aOrgaType)
	End Forall

Returns:
PersonTypesVariant array of strings
History:
04.APR.2000ggredesign
Summmary Top

Public Property Set SurrogationDate AsNotesDateTime

Summmary Top

Public Property Get SurrogationDate AsNotesDateTime

Summmary Top

Public Property Get CurrentOrgaDatabase AsNotesDatabase

This method returns an NotesDatabase object of the current LSA Orga database. Usually is not necessary to get this object as all objects of this interface know the LSAOrga database, and the LSAOrgaManager also checks if it exists and has the correct format. In the config database you can find all the information about the LSA Orga database by the alias of it. Please have in mind that you should not directly work with the documents in the LSAOrga!

Returns:
NotesDatabaseobject
History:
04.APR.2000ggredesign
Summmary Top

Public Property Get CurrentLog AsLSAOrgaLog

This method returns an LSAOrgaLog object, which reflects the current log database. If you want to create your own log documents, please use the "LSAOrgaLog" class.

Returns:
LSAOrgaLogobject
History:
04.APR.2000ggredesign
Summmary Top

Public Property Get ViewAddresses AsNotesView

Summmary Top

Public Property Get ViewAllOrgaDocs AsNotesView

Summmary Top

Public Property Get AddressDB AsNotesDatabase

Summmary Top

Public Property Get InstanceID AsString

Summmary Top

Public Property Get AddressLUView AsNotesView

Summmary Top

Public Property Get ContactLUView AsNotesView

Summmary Top

Public Property Get OrganizationLUView AsNotesView

Summmary Top

Public Property Get IdLUView AsNotesView

Summmary Top

Public Property Get CustomerLUView AsNotesView

Summmary Top

Public Property Get AttributeArray AsVariant

Summmary Top

Public Property Get LabelTypes AsVariant

Summmary Top

Public Property Get LabelFormats AsVariant

Summmary Top

Public Property Get OpeningTypes AsVariant

Summmary Top

Public Property Get OpeningFormats AsVariant

Summmary Top

Public Property Get ClosingTypes AsVariant

Summmary Top

Public Property Get ClosingFormats AsVariant

Summmary Top

Public Property Get ContactDisplayRule AsString

Summmary Top

Public Property Get OrganizationDisplayRule AsString

Summmary Top

Public Property Get PhoneFormat AsString

Summmary Top

Public Property Set PhoneFormat AsString

Summmary Top

Public Property Get CountriesWithoutAreaCode AsVariant

Summmary Top
Method Detail

New

Public Sub New(Database As Variant,OrgaDBAlias As String,LogDatabase As Variant,LogDBAlias As String)
Constructor of class

Example:
     Dim OrgaManager as LSAOrgaManager
     Set OrgaManager = New LSAOrgaManager("", "LSAORGA", "", "LSAORGALOG")

Parameters:
OrgaDBVariantreference to the LSAOrga database, this can be any of the following :
string : "Server!!Path";
array of strings : "Server" : "Path";
NotesDatabase : a NotesDatabase object;
string : "" (empty string) -> ignore this parameter and use the second
OrgaAliasStringLSA alias name of the database as configured in the LSA Configure database if this parameter is empty, the default alias "LSAOrga" is used
OrgaLogVariantreference to the LSAOrgaLog database, this can be any of the following :
string : "Server!!Path"
array of strings : "Server":"Path"
NotesDatabase : a NotesDatabase object
string : "" (empty string) -> ignore this parameter and use the fourth
OrgaLogAliasStringLSA alias name of the database as configured in the LSA Configure database
if this parameter is empty, the default alias "LSAOrgaLog" is used

Returns:
LSAOrgaManagerclass
History:
04.APR.2000ggredesign
Summmary Top

Delete

Public Sub Delete
Summmary Top

PopulateAllChanges

Public Function PopulateAllChanges As Integer
This method runs the update on the LSAOrga hierarchy. After any changes to LSA Orga objects that affect other units (e.g. name change of a person affects the group where the person is member), the programmer must call this method in order to make the database consistent.
In the LSA Orga view "Administration:UpdateResponses" you can find all update request documents which were created. These have to be processed by the "PopulateAllChanges" method - it calls the agent with the same name.
For more information about the settings for this agent please refer to the Help database of the LSAOrga.

History:
04.APR.2000ggredesign
Summmary Top

GetTypeByName

Public Function GetTypeByName(OrgaName As String) As LSAOrgaType
This method searches the LSA Orga database for a LSA Type object identified by name. If this type does not exist, the error 1756 is generated.
Further you get an entry in the LSAOrga Log database - as for this example:
"LSAOrgaManager: Error 1756 - Could not find a type document by the name [OrgaTypeName] in LSA organization database".

Use Case:
If you want to create an new Orga Unit you must have a LSAOrgaType object - for instance a new orga unit of the Type "Department".
Dim OrgaType as LSAOrgaType
Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim Unit as LSAOrgaUnit
			'Create a new Department unit:
          Set OrgaType  = OrgaManager.GetTypeByName("Department")
          Set Unit = OrgaManager.NewUnit("Sales", OrgaType, "Sales", "0")
          Call Unit.Save()
          Delete Unit

Parameters:
OrgaNameStringThe name of the LSA Orga type object
Returns:
LSAOrgaTypeobject
Errors:
1756ErrOrgaIntNoTypeByName No object found by the given name
History:
04.APR.2000ggredesign
Summmary Top

GetTypeByExtSyncKey

Public Function GetTypeByExtSyncKey(ExtSystem As String,ExtSyncKey As String) As LSAOrgaType
This method searches the LSA Orga database for a LSA Type object identified by a external system/key combination. If the type could not be found, you get the error 1757.
In the Log database a document is created which shows this error:
"LSAOrgaManager: Error 1757 - Could not find a type document by the external syncronisation key [ExtSystem:ExtSyncKey] in LSA organization database".

Use Case:
You can use this method to get the OrgaType when you want to create a new unit of that type. In this example in the source document for the Unit you have also the information about the type.

Dim OrgaType as LSAOrgaType
Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim Unit as LSAOrgaUnit
Dim docSource as NotesDocument
dim nameSource as String
dim keyInSource as string
dim sourceTypeName as String
           'Create a new unit from the source document:
           ....
          nameSource = "Phonebook"
          sourceTypeName = docSource.OrganizationalClassName(0)
          Set OrgaType  = OrgaManager.GetTypeByExtSyncKey(nameSource,sourceTypeName)
          keyInSource = docSource.EntryName(0)
          Set Unit = OrgaManager.NewUnit(keyInSource, OrgaType, "Orga" + keyInSource, "0")
          Call Unit.Save()
          Delete Unit

Parameters:
ExtSytemStringThe name of the external system
ExtSyncKeyStringThe external key that identifies the object with the given system
Returns:
LSAOrgaTypeobject
Errors:
1757ErrOrgaIntNoTypeByExtSyncKey No object found by given system/key
History:
04.APR.2000ggredesign
Summmary Top

GetUnitByName

Public Function GetUnitByName(OrgaInternalName As String) As LSAOrgaUnit
This method searches the LSA Orga database for a LSA Unit object identified by name. You can also use this method to find out if a unit with this name already exists.
If the unit was not found, the error 1758 (in older versions 1757) is generated.
In the Log database a document is created which shows this error:
"LSAOrgaManager: Error 1758 - Could not find a unit document by the name [OrgaUnitName] in LSA organization database".

Use Case:
If you want to set new values to a unit document in the LSA Orga you need to get the object of that unit. For example, the unit has the Name "Sales2".

Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim Unit as LSAOrgaUnit
Dim unitName as String

unitName = "Sales2" set unit = OrgaManager.GetUnitByName(unitName) .... call Unit.Save() Delete Unit

Parameters:
OrgaInternalNameStringThe name of the LSA Orga unit object
Returns:
LSAOrgaUnitobject
Errors:
1758(1757) ErrOrgaIntNoUnitByName No object found by the given name
History:
04.APR.2000ggredesign
Summmary Top

GetUnitByNotesName

Public Function GetUnitByNotesName(OrgaNotesName As NotesName) As LSAOrgaUnit
This method searches the LSA Orga database for a LSA Unit object identified by the NAB name. You can also use this method to find out if a unit with this notes name already exists. If the unit was not found, the error 1759 is generated.
In the Log database a document is created which shows this error:
"LSAOrgaManager: Error 1759 - Could not find a unit document by the notes name [UnitNotesName] in LSA organization database". (In older version the number shown is 1758).

Use Case:
If you want to set new values to a unit document in the LSA Orga you need to get the object of that unit. For example, the unit has the Notes Name "OrgaSales2".
Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim Unit as LSAOrgaUnit
Dim unitName as String

unitName = "OrgaSales2" set unit = OrgaManager.GetUnitByNotesName(unitName) ....'change the values of that unit call Unit.Save() Delete Unit

Parameters:
OrgaNotesNameStringThe NAB name of the LSA Orga unit object
Returns:
LSAOrgaUnitobject
Errors:
1759ErrOrgaIntNoUnitByNotesName No object found by the given NAB name
History:
04.APR.2000ggredesign
Summmary Top

GetUnitByExtSyncKey

Public Function GetUnitByExtSyncKey(ExtSystem As String,ExtSyncKey As String) As LSAOrgaUnit
This method searches the LSA Orga database for a LSA Unit object identified by an external system/key combination. If the unit was not found, the error 1750 is generated (in older versions no error is generated).
In the Log database no document is created!

Use Case:
If you want to set new values to a unit document in the LSA Orga you need to get the object of that unit. You can also use this method to find out if a unit with this ID already exists in the LSAOrga.
For example, there is a source document which has the external syncronization key in the field "MyID" .
Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim Unit as LSAOrgaUnit
Dim docSource as NotesDocument
dim nameSource as String
dim sourceUnitName as String

'Find a the unit from the source document: .... nameSource = "Phonebook" sourceUnitName = docSource.MyID(0) set unit = OrgaManager.GetUnitByExtSyncKey(nameSource,sourceUnitName) ....'change the properties of that unit call Unit.Save() Delete Unit

Parameters:
ExtSystemStringThe name of the external system
ExtSyncKeyStringThe external key that identifies the object with the given system
Returns:
LSAOrgaUnitobject
Errors:
1750ErrOrgaIntNoUnitByExtSyncKey No object found by given system/key
History:
04.APR.2000ggredesign 13.NOV.2000 RPr no logging but generate error
Summmary Top

NewOrgaCollection

Public Function NewOrgaCollection(ExtSystem As String,OrgaClassName As Variant,NotesName As Variant,OrgaTypeName As Variant) As LSAOrgaCollection
This method fills a collection with LSA Orga objects that match the given criteria. Every parameter can have the value "" (empty string). At least one of these parameters must have a valid value to find OrgaUnits or OrgaTypes. OrgaTypes are only returned if you specify the OrgaClassName with "OrgaType". If you specify "OrgaType" you must not specify any other OrgaClassName. Search for OrgaTypes only works correct from LiSA Version 2.0c .
If no matching objects were found, an empty LSAOrgaCollection is returned (.Count = 0, .GetFirst Is Nothing).

Use Case:
You want to find all Person units which were imported from the external system "Phonebook"
Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim allPersons as LSAOrgaCollection
Dim extSystemName as string
		'Create Collection with all imported persons:
		extSystemName = "Phonebook"
		set allPersons = OrgaManager.NewOrgaCollection(extSystemName,"OrgaPerson","","")

Parameters:
ExtSystemStringobjects are filtered by external system (must have been set by .SyncInfo for units or types)
OrgaClassNameVariantString or array of strings. Objects are filtered by the LSA Orga Subtype ("OrgaGroup", "OrgaPerson"," OrgaTrait" and/or "OrgaType").
NotesNameVariantString or array of strings. objects are filtered by the given NAB names.
OrgaTypeNameVariantString or array of strings. objects are filtered by LSA Orga type names. The type names can be retrieved by attributes of the LSAOrgaManager (LSAOrgaManager.PersonTypes ...).
Returns:
LSAOrgaCollectionobject
Errors:
ErrOrgaIntIllegalDocTypeAn illegal document was found in the LSA Orga database. This error will also occur if AddressDocuments, UpdateRequests or otherbackend documents were found. That's why it is very important that at least one search parameter is set to a valid value to find either types or units .
History:
04.APR.2000ggredesign 17.11.2000 RPr Bugfix Check Type Definitions
Summmary Top

NewType

Public Function NewType(OrgaName As String,OrgaSubtype As String) As LSAOrgaType
This method creates a new LSAOrgaType object (orga type). The default values for a Type Definition are: All these settings can be overwritten by accessing the properties of this new orga type.
A new orga type must be saved before it exists in the LSAOrga and before you can use it to create new units of this orga type.

Use Case:
You can create new type definitions depending on the data you get from an external system.
Dim OrgaType as LSAOrgaType
Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim Unit as LSAOrgaUnit
Dim docSource as NotesDocument
dim nameSource as String
dim keyInSource as string
dim sourceTypeName as String
           'Create a new type from the source document:
           ....
          nameSource = "Phonebook"
          sourceTypeName = docSource.OrganizationalClassName(0)
          Set OrgaType  = OrgaManager.GetTypeByExtSyncKey(nameSource,sourceTypeName)
          If OrgaType Is Nothing Then
            'we must create this Type:
            set OrgaType = OrgaManager.NewType(docSource.OrganizationalClassName(0), "OrgaGroup")
          End if

Parameters:
OrgaNameStringThe name of the type object (for instance "Department")
OrgaSubtypeStringdefines which kind of type object is to be created ("OrgaGroup", "OrgaPerson" or "OrgaTrait").
Returns:
LSAOrgaTypeobject
History:
04.APR.2000ggredesign
Summmary Top

NewUnit

Public Function NewUnit(OrgaName As String,OrgaType As LSAOrgaType,OrgaNotesName As String,OrgaNotesType As String) As LSAOrgaUnit
This method creates a new LSAOrgaUnit object. The unit will be created according to the values of the type definition in OrgaType. You must save the unit before it exists in the Orga database and before you can assign it as child, parent or surrogate to other units!

Use Case:
If you have a synchronization with an external system, you might want to create new units according to the documents from the external system like a phonebook, for instance.
Dim OrgaType as LSAOrgaType
Dim OrgaManager as New LSAOrgaManager("","LSAORGA","","LSAORGALOG")
Dim Unit as LSAOrgaUnit
Dim docSource as NotesDocument
Dim unitName as String
dim nameSource as String
dim sourceTypeName as String
        'Create or update the unit from the source document:
        unitName = docSource.NameField(0)
        Set unit = orgaMgr.getUnitByName( UnitName)
        If unit Is Nothing Then				' The unit is new
            ' Get unitType - according to a field in the docSource
            Set OrgaType = orgaMgr.GetTypeByName(docSource.OrganizationalClassName(0))
            ' Create new unit:
            Set unit = orgaMgr.NewUnit(UnitName, OrgaType, docSource.EntryName(0), "0")
             ....
             call unit.save
             Delete unit
        End If

Parameters:
OrgaNameStringThe name of the unit object ("Marketing Department")
OrgaTypeLSAOrgaTypeAn instance of the LSA Orga type which defines the unit.
OrgaNotesNameStringThe NAB name of the unit, can be "" (empty string). If the OrgaNotesName is "", the OrgaNotesType must be "5" for a group or trait, or "Interface" or "Orga" for person units. If you choose "Orga", the person unit cannot be set a NotesName later on. If you have specified the unit to have a NotesName but do not set one in this method or before you save the unit the first time, the unit will not be saved!
OrgaNotesTypeStringIf the unit is a group, this parameter defines the type of the resulting NAB group ("0" = multi purpose, "1" = mail only, "2" = ACL only "3" = deny list only, "5" = no group in the NAB). If you have a unit of a person type, the parameter can be "NAB", "Orga" or "Interface" where "NAB" means, the person data are imported from the NAB (you should never create a person with the interface classes and set this value to "NAB"!). If you have the value "Orga" for the NotesType, there will be no NotesName for this person unit. This would mean, that these persons will not be shown as group members in the Domino Directory. From the backend you should set the value "Interface" which gives the opportunity to create the unit without a NotesName and change this later by setting a NotesName via the Backend classes. The NotesType also must fit the setting in the type definition: for groups, traits and persons all values can be chosen if this parameter in the type definition is set to "Choose when created /4". In all other cases the NotesType will be calculated from the type definition independently from the parameter in the new unit.
Returns:
LSAOrgaUnitobject
History:
04.APR.2000ggredesign
Summmary Top

getAddressDocsByKey

Public Function getAddressDocsByKey(key As String) As NotesDocumentCollection
Summmary Top

GetNotesDatabaseByAliasParameter

Private Function GetNotesDatabaseByAliasParameter(AliasName As String,DefaultAliasName As String) As NotesDatabase
Summmary Top

GetOrgaDocByKey

Private Function GetOrgaDocByKey(OrgaView As String,Key As String) As NotesDocument
Summmary Top

GetOrgaTypeS

Private Function GetOrgaTypeS(OrgaView As String) As Variant
Summmary Top

IsOrgaDB

Private Sub IsOrgaDB(DBase As NotesDatabase)
Summmary Top

GetNotesDatabaseByDBParameter

Private Function GetNotesDatabaseByDBParameter(DBase As Variant) As NotesDatabase
Summmary Top

null

Public Sub null
Summmary Top

TopLotusScript Doc
© Lotus Professional Services
generated on : 05-Apr-01 8:39:59 AM